ata6505 2.2.1
Loading...
Searching...
No Matches
ata6505.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2026 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
27
28#ifndef ATA6505_H
29#define ATA6505_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_uart.h"
52
58
63
68
74#define ATA6505_TX_DRV_BUFFER_SIZE 100
75#define ATA6505_RX_DRV_BUFFER_SIZE 300
76 // ata6505_cmd
78
83
88
93#define ATA6505_MAP_MIKROBUS( cfg, mikrobus ) \
94 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
95 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
96 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
97 cfg.nres = MIKROBUS( mikrobus, MIKROBUS_INT );
98 // ata6505_map // ata6505
101
106typedef struct
107{
108 // Output pins
109 digital_out_t en;
110
111 // Input pins
112 digital_in_t nres;
113
114 // Modules
115 uart_t uart;
116
117 // Buffers
120
121} ata6505_t;
122
127typedef struct
128{
129 // Communication gpio pins
130 pin_name_t rx_pin;
131 pin_name_t tx_pin;
132
133 // Additional gpio pins
134 pin_name_t en;
135 pin_name_t nres;
136
137 // Static variable
138 uint32_t baud_rate;
140 uart_data_bits_t data_bit;
141 uart_parity_t parity_bit;
142 uart_stop_bits_t stop_bit;
143
145
150typedef enum
151{
154
156
162
173
188
201err_t ata6505_generic_write ( ata6505_t *ctx, uint8_t *data_in, uint16_t len );
202
215err_t ata6505_generic_read ( ata6505_t *ctx, uint8_t *data_out, uint16_t len );
216
226void ata6505_set_en_pin ( ata6505_t *ctx, uint8_t state );
227
237
238#ifdef __cplusplus
239}
240#endif
241#endif // ATA6505_H
242 // ata6505
244
245// ------------------------------------------------------------------------ END
ata6505_return_value_t
ATA6505 Click return value data.
Definition ata6505.h:151
@ ATA6505_ERROR
Definition ata6505.h:153
@ ATA6505_OK
Definition ata6505.h:152
#define ATA6505_RX_DRV_BUFFER_SIZE
Definition ata6505.h:75
#define ATA6505_TX_DRV_BUFFER_SIZE
ATA6505 driver buffer size.
Definition ata6505.h:74
void ata6505_set_en_pin(ata6505_t *ctx, uint8_t state)
ATA6505 set EN pin function.
void ata6505_cfg_setup(ata6505_cfg_t *cfg)
ATA6505 configuration object setup function.
err_t ata6505_init(ata6505_t *ctx, ata6505_cfg_t *cfg)
ATA6505 initialization function.
err_t ata6505_generic_write(ata6505_t *ctx, uint8_t *data_in, uint16_t len)
ATA6505 data writing function.
err_t ata6505_generic_read(ata6505_t *ctx, uint8_t *data_out, uint16_t len)
ATA6505 data reading function.
uint8_t ata6505_get_nres_pin(ata6505_t *ctx)
ATA6505 get NRES pin function.
ATA6505 Click configuration object.
Definition ata6505.h:128
uint32_t baud_rate
Definition ata6505.h:138
pin_name_t nres
Definition ata6505.h:135
bool uart_blocking
Definition ata6505.h:139
uart_data_bits_t data_bit
Definition ata6505.h:140
pin_name_t tx_pin
Definition ata6505.h:131
pin_name_t rx_pin
Definition ata6505.h:130
uart_stop_bits_t stop_bit
Definition ata6505.h:142
pin_name_t en
Definition ata6505.h:134
uart_parity_t parity_bit
Definition ata6505.h:141
ATA6505 Click context object.
Definition ata6505.h:107
uint8_t uart_rx_buffer[ATA6505_RX_DRV_BUFFER_SIZE]
Definition ata6505.h:118
uint8_t uart_tx_buffer[ATA6505_TX_DRV_BUFFER_SIZE]
Definition ata6505.h:119
uart_t uart
Definition ata6505.h:115
digital_out_t en
Definition ata6505.h:109
digital_in_t nres
Definition ata6505.h:112